home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Today - The Disc! 5
/
CD-ROM Today - The Disc (Issue 5)(November 1994).ISO
/
mac
/
Mac shareware
/
Education
/
RLaB
/
examples
/
conv.r
< prev
next >
Wrap
Text File
|
1994-09-21
|
314b
|
20 lines
#
# Simplistic convolution function.
# x and y must be vectors...
# No error checking.
#
conv = function( x , y )
{
local( X , Y , n, tmp );
n = x.n + y.n - 1;
X = fft( x, n );
Y = fft( y, n );
tmp = ifft( X .* Y );
if( type(x) == "real" && type(y) == "real") { tmp = real(tmp); }
return tmp;
};